package com.baitai.system.service.impl;

import java.util.List;
import com.baitai.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baitai.system.mapper.SysUseConsigneeInfoMapper;
import com.baitai.system.domain.SysUseConsigneeInfo;
import com.baitai.system.service.ISysUseConsigneeInfoService;

/**
 * 收货人信息Service业务层处理
 * 
 * @author xx
 * @date 2024-07-20
 */
@Service
public class SysUseConsigneeInfoServiceImpl implements ISysUseConsigneeInfoService 
{
    @Autowired
    private SysUseConsigneeInfoMapper sysUseConsigneeInfoMapper;

    /**
     * 查询收货人信息
     * 
     * @param id 收货人信息主键
     * @return 收货人信息
     */
    @Override
    public SysUseConsigneeInfo selectSysUseConsigneeInfoById(Long id)
    {
        return sysUseConsigneeInfoMapper.selectSysUseConsigneeInfoById(id);
    }

    /**
     * 查询收货人信息列表
     * 
     * @param sysUseConsigneeInfo 收货人信息
     * @return 收货人信息
     */
    @Override
    public List<SysUseConsigneeInfo> selectSysUseConsigneeInfoList(SysUseConsigneeInfo sysUseConsigneeInfo)
    {
        return sysUseConsigneeInfoMapper.selectSysUseConsigneeInfoList(sysUseConsigneeInfo);
    }

    /**
     * 新增收货人信息
     * 
     * @param sysUseConsigneeInfo 收货人信息
     * @return 结果
     */
    @Override
    public int insertSysUseConsigneeInfo(SysUseConsigneeInfo sysUseConsigneeInfo)
    {
        sysUseConsigneeInfo.setCreateTime(DateUtils.getNowDate());
        return sysUseConsigneeInfoMapper.insertSysUseConsigneeInfo(sysUseConsigneeInfo);
    }

    /**
     * 修改收货人信息
     * 
     * @param sysUseConsigneeInfo 收货人信息
     * @return 结果
     */
    @Override
    public int updateSysUseConsigneeInfo(SysUseConsigneeInfo sysUseConsigneeInfo)
    {
        sysUseConsigneeInfo.setUpdateTime(DateUtils.getNowDate());
        return sysUseConsigneeInfoMapper.updateSysUseConsigneeInfo(sysUseConsigneeInfo);
    }
    /**
     * 修改收货人信息
     *
     * @param sysUseConsigneeInfo 收货人信息
     * @return 结果
     */
    @Override
    public int userUpdateSysUseConsigneeInfo(SysUseConsigneeInfo sysUseConsigneeInfo)
    {
        if(sysUseConsigneeInfo.getIsDefault().equals("1")){
            sysUseConsigneeInfoMapper.updateDefault(sysUseConsigneeInfo.getUserId());
        }
        sysUseConsigneeInfo.setUpdateTime(DateUtils.getNowDate());
        return sysUseConsigneeInfoMapper.updateSysUseConsigneeInfo(sysUseConsigneeInfo);
    }

    /**
     * 批量删除收货人信息
     * 
     * @param ids 需要删除的收货人信息主键
     * @return 结果
     */
    @Override
    public int deleteSysUseConsigneeInfoByIds(Long[] ids)
    {
        return sysUseConsigneeInfoMapper.deleteSysUseConsigneeInfoByIds(ids);
    }

    /**
     * 删除收货人信息信息
     * 
     * @param id 收货人信息主键
     * @return 结果
     */
    @Override
    public int deleteSysUseConsigneeInfoById(Long id)
    {
        return sysUseConsigneeInfoMapper.deleteSysUseConsigneeInfoById(id);
    }
}
